using System.Collections;
using System.Collections.Generic;
using QFramework;
using UnityEngine;
using UnityEngine.UI;

public class TimeStop : MonoBehaviour
{
    public static bool isTimeStop = false;

    public Image image;
    public Sprite[] sprites;
    public Text text;
    void Start()
    {
        //按钮点击监听
        GetComponent<Button>().onClick.AddListener(() =>
        {
            Debug.Log("暂停");
            isTimeStop = !isTimeStop;
            UpdateStatus();
        });
    }
    //修改图片和文字
    void UpdateStatus()
    {
        if (isTimeStop)
        {
            image.sprite = sprites[0];
            text.text = "继续";
        }
        else
        {
            image.sprite = sprites[1];
            text.text = "暂停";
        }
    }
}
